<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/common/meta.jsp" %>
<title>Insert title here</title>
<script type="text/javascript">
	$(document).ready(function(){
		$("#allsysclasstree a").click(nodeClick);
		//$("#allorgtree a").append(" <span ><span style='color:red'>添加</span> <span style='color:red'>删除</span></span>");
		});

	function nodeClick(){
		var name = $(this).text();
		var id = this.id;
		$("#selectedSysClassId").val(id);
		$("#currNode").text(name);
		}
	var alertErr =  "${ctx }/common/alertErr.jsp?alert=";
	function check(){
		var a = event.srcElement;
		if($("#selectedSysClassId").val()==""){
			a.href=alertErr+"对不起，请选择要操作的节点！";
			if("navTabTodo"==a.target){
			a.href = a.href+"&type=json";
				}
			return false;
			}
		return true;
		}
	function edit(){
		if(!check()) return false;
		var url = '${ctx}/sys/sys-type!input.action?id='+$('#selectedSysClassId').val();
		var a = event.srcElement;
		a.href = url;
		}
	function add(){
		if(!check()) return false;
		var url = '${ctx}/sys/sys-type!input.action?parentId='+$('#selectedSysClassId').val()
		var a = event.srcElement;
		a.href = url;
		}
	function del(){
		if(!check()) return false;
		var a = event.srcElement;
		var url = '${ctx}/sys/sys-type!delete.action?id='+$('#selectedSysClassId').val();
		a.href = url;
		var val = alertMsg.confirm('所有下级节点也同时被删除，且无法恢复！确定要删除吗？',{okCall:function(){
			var url = '${ctx}/sys/sys-type!delete.action?id='+$('#selectedSysClassId').val();
			a.href = url;
			alert(a.href);
			}});
		
		}
</script>
</head>
<body>

<form id="pagerForm" method="post" action="${ctx }/common/sys-type-ui!getAllSysClassUL.action">

</form>

<div id="allsysclasstree" style=" float:left; display:block; margin:10px; overflow:auto; width:300px; height:95%; border:solid 1px #CCC; line-height:21px; background:#FFF;">
<ul class="tree treeFolder collapse" >
	${ul }
</ul>
</div>
<div style="height:120;width:1;"></div>
<div class="formBar" style="text-align:center;">
<div style="width:300px;;height:100px;">
				<input type="hidden" name="selectedSysClassId" id="selectedSysClassId" value="">
				<div style="height:35px;line-height:35px;text-align:left;">当前节点：<b><span id="currNode" style="color:ff0000"></span></b></div>
	
			
				<div>
					<ul class="toolBar">
						<li>
								<a  class="add"  href="#" target="navTab" onclick="add();" title="添加节点">添加分类</a>
						</li>
						<li>
								<a class="delete" href="#" target="navTabTodo" onclick="return del();" title="删除节点">删除分类</a>
						</li>
						<li>
								<a class="edit"  href="#"  target="navTab" onclick="edit();" title="修改节点">修改分类</a>
						</li>
					</ul>

				</div>
				


</div>
</div>
</body>
</html>